﻿<Window x:Class="P2.Cuberry.Modules.Framework.UserGroup.UserGroupsDetailsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    xmlns:basec="clr-namespace:P2.Cuberry.Framework.Helper;assembly=P2.Cuberry.Framework.Helper"    
    
            
        Title="Peacequare Cuberry" Width="920" Height="600" 
        Background="{DynamicResource P2BackgroundBrush}" 
        Loaded="Window_Loaded"
        Closing="Window_Closing" Icon="/P2.Cuberry.Modules.Framework.UserGroup;component/Images/CuberryIcon32.ico">

    <Window.Resources>

        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/P2.Cuberry.Framework.Layout;component/Styles/Styles.xaml"/>
                <ResourceDictionary Source="/P2.Cuberry.Framework.Layout;component/Styles/CuberryDataGrid.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <Grid.Resources>
            <Image x:Key="SaveIcon" Height="16" Width="16" Source="/P2.Cuberry.Modules.Framework.UserGroup;component/Images/save.png" />
            <Image x:Key="CancelIcon" Height="16" Width="16" Source="/P2.Cuberry.Modules.Framework.UserGroup;component/Images/cancel.png" />
            <Image x:Key="DeleteIcon" Height="16" Width="16" Source="/P2.Cuberry.Modules.Framework.UserGroup;component/Images/Remove.ico"  />
            <Image x:Key="Printer2Icon" Height="16" Width="16" Source="/P2.Cuberry.Modules.Framework.UserGroup;component/Images/printer2.png" />
            <Image x:Key="AddIcon" Height="16" Width="16" Source="/P2.Cuberry.Modules.Framework.UserGroup;component/Images/add.png" />
            

        </Grid.Resources>



        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="40" />
            <RowDefinition Height="35" />
            <RowDefinition Height="*"/>
            <RowDefinition Height="35" />
        </Grid.RowDefinitions>

        <!-- Row 0 Start -->
        <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Content="{Translate DialogHeaderUserGroupDetail}" Style="{StaticResource P2DetailViewHeaderTextStyle}" />


        <Separator Margin="0,0,0,0" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" VerticalAlignment="Bottom" Height="0"/>
        <!-- Row 0 End -->

        <!-- Row 1: Menu Start -->
        <Border  Grid.Row="1" Grid.Column="0"  Style="{StaticResource P2MenuBorderStyle}">
            <Grid>
            <Menu Grid.Row="1" x:Name="menuMain" Style="{StaticResource P2MenuStyle}" >
                <MenuItem x:Name="UserGroupSaveBtn" Margin="2,1,0,2"  InputGestureText="Ctrl+S" Header="{Translate SaveBtn}" Command="{Binding UserGroupSaveCommand}" Icon="{StaticResource SaveIcon}" Style="{StaticResource P2MenuItemStyle}" />
                <MenuItem x:Name="CloseBtn" Margin="2,1,0,2" InputGestureText="Ctrl+X" Header="{Translate SaveAndCloseBtn}" Command="{Binding UserGroupCloseCommand}" Icon="{StaticResource CancelIcon}" Style="{StaticResource P2MenuItemStyle}"/>
                
                <MenuItem x:Name="DeleteBtn" Margin="2,1,0,2" Header="{Translate DeleteBtn}" Command="{Binding UserGroupDeleteCommand}" Icon="{StaticResource DeleteIcon}" Style="{StaticResource P2MenuItemStyle}"/>
                <MenuItem x:Name="PrintBtn" Margin="2,1,0,2" Header="{Translate PrintBtn}" Click="PrintBtn_Click" Icon="{StaticResource Printer2Icon}" Style="{StaticResource P2MenuItemStyle}"/>
                </Menu>
                <Menu Grid.Row="1" HorizontalAlignment="Right" x:Name="menuMainRight" Style="{StaticResource P2MenuStyle}" >
                    <MenuItem x:Name="HistoryBtn" Command="{Binding HistoryCommand}"  Style="{StaticResource P2MenuItemStyleHistory}"/>
                    <MenuItem x:Name="InfoBtn" Command="{Binding InfoCommand}"  Style="{StaticResource P2MenuItemStyleInfo}"/>
                </Menu>
            </Grid>
        </Border>
        <!-- Row 1 End -->

        <!-- Row 2: All Fields -->
        <Border  Grid.Row="2" Grid.Column="0"  Style="{StaticResource P2ContentBorderStyle}">
            <Grid Grid.Row="2" Grid.Column="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition Height="97.277"/>
                    <RowDefinition Height="239.723*" />
                    <RowDefinition Height="1"/>
                </Grid.RowDefinitions>

                <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Left" Margin="5,3,0,0" Name="UserGroupNameL" Width="120" Height="28" VerticalAlignment="Top" Content="{Translate UserGroupNameL}"></Label>
                <TextBox Margin="5,24,5,0" Name="UserGroupName" Height="23" Text="{Binding UserGroupName, ValidatesOnExceptions=True, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{StaticResource ErrorTemplate}" VerticalAlignment="Top" Style="{StaticResource P2TextBoxStyle}" 
                          IsReadOnly="{Binding NameReadOnly}"
                          />
                <Label Margin="3,46,88,23" Name="UserGroupActiveL" Content="{Translate UserGroupActiveL}"></Label>
                <CheckBox Grid.ColumnSpan="2"  Margin="9,0,31,0" Name="UserGroupActive" Height="23" IsChecked="{Binding Active, ValidatesOnExceptions=True, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{StaticResource ErrorTemplate}" VerticalAlignment="Bottom" IsThreeState="True" />

                <Grid Grid.Row="1" Grid.Column="0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <Border Grid.Row="0" Margin="5,0,5,5"   VerticalAlignment="Stretch" BorderThickness="1" CornerRadius="2,2,2,2" BorderBrush="#FF6893CF">
                        <Grid ShowGridLines="False" Name="UserRightModules" >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="34"/>
                            </Grid.RowDefinitions>

                            <Label Grid.Row="0" Name="ModuleListL" Width="120" Height="28"  VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0" Content="{Translate ModuleListL}" FontWeight="Bold" />

                            <DataGrid Grid.Row="1"  Margin="3,0,3,0" 
                                         Name="UserGroupModuleList"  
                                         ItemsSource="{Binding UserGroupModuleList}" 
                                         MouseDoubleClick="UserGroupModuleList_MouseDoubleClick"
                                         SelectionChanged="UserGroupModuleList_SelectionChanged"
                                         Style="{DynamicResource CuberryDataGridStyle}"
                                         VerticalAlignment="Top" 
                                         SelectionMode="Single"
                                         IsEnabled="{Binding GridOpen}">

                                <DataGrid.Columns>

                                    <DataGridTextColumn Header="{Translate ModuleNameL}" IsReadOnly="True" Binding="{Binding ModuleName, StringFormat=F2}" MinWidth="40" Width="*" />

                                    <DataGridTemplateColumn Header="{Translate AccessRightL}" MinWidth="40" Width="140" >
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Button Content="" Click="AccessButton_Click"  Background="{Binding Path=ActiveColor, Mode=TwoWay}" Width="15" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" MaxWidth="15" ClipToBounds="False" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </Grid>
                    </Border>




                </Grid>

                <Border Grid.Column="1" Grid.Row="1" Margin="5,0,5,5"   VerticalAlignment="Stretch" BorderThickness="1" CornerRadius="2,2,2,2" BorderBrush="#FF6893CF">
                    <Grid ShowGridLines="False" Name="UserSpecialRightGrid">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="34"/>
                        </Grid.RowDefinitions>

                        <Label Grid.Row="0" Name="CreditL" Width="120" Height="28" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0" Content="{Translate SpecialRightsL}" FontWeight="Bold" />

                        <DataGrid Grid.Row="1" Margin="3,0,3,0" 
                                     Name="UserGroupSpecialRightsListD"                                                                            
                                     ItemsSource="{Binding UserGroupSpecialRightsList}"                                     
                                     MouseDoubleClick="UserGroupSpecialRightsList_MouseDoubleClick" 
                                     Style="{DynamicResource CuberryDataGridStyle}"
                                     VerticalAlignment="Top" 
                                     SelectionMode="Single"
                                     IsEnabled="{Binding GridOpen}">
                            
                            <DataGrid.Columns>

                                <DataGridTextColumn Header="{Translate DialogNameL}" Binding="{Binding DialogName, StringFormat=F2}" IsReadOnly="True" MinWidth="100" Width="200" />

                                <DataGridTextColumn Header="{Translate ControlNameL}" Binding="{Binding ControlName}" IsReadOnly="True" MinWidth="40" Width="200" />

                                <DataGridTextColumn   Header="{Translate AccessRightL}" IsReadOnly="True"  Binding="{Binding AccessRight}" Width="100" MinWidth="40" />

                                <DataGridTextColumn   Header="{Translate StatusL}" IsReadOnly="True"  Binding="{Binding StatusName}" Width="*" MinWidth="40" />


                            </DataGrid.Columns>
                        </DataGrid>

                        <Button IsEnabled="{Binding GridOpen}" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="3,0,0,3" Click="UserGroupSpecialRightAddBtn_Click" Name="UserGroupSpecialRightAddBtn"  Command="{Binding UserGroupSpecialRightAddCommand}" Height="25"  Width="25">
                            <Image  Source="/P2.Cuberry.Modules.Framework.UserGroup;component/Images/add.png"></Image>
                        </Button>
                        <Button IsEnabled="{Binding GridOpen}" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="28,0,0,3" Click="UserGroupSpecialRightDeleteBtn_Click" Name="UserGroupSpecialRightDeleteBtn"  Command="{Binding UserGroupSpecialRightDeleteCommand}"  Height="25" Width="25">
                            <Image  Source="/P2.Cuberry.Modules.Framework.UserGroup;component/Images/Remove.ico"></Image>
                        </Button>

                    </Grid>
                </Border>
                <TextBox Margin="4,24,6,8" Name="UserGroupDescription" Style="{StaticResource P2TextBoxStyle}" Text="{Binding UserGroupDescription, ValidatesOnExceptions=True, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{StaticResource ErrorTemplate}" Grid.Column="1" />
                <Label Content="{Translate UserGroupDescriptionL}" Height="28" Margin="4,3,87,0" Name="UserGroupDescriptionL" VerticalAlignment="Top" Grid.Column="1" />
            </Grid>
        </Border>

        <!-- Row 2: End -->


        <!-- Row 3: Bottom: Status Bar Start -->
        <Border Grid.Row="3" Grid.Column="0" Style="{StaticResource P2StatusStripBorderStyle}" >
            <Grid Grid.Row="3" Grid.Column="0" Style="{StaticResource P2StatusStripGridStyle}">
                <basec:P2StatusStrip x:Name="StatusStrip" MessageStack2="{Binding MessageStack}" Grid.Column="0" Grid.Row="3" Height="Auto" Width="Auto" Background="White" HorizontalAlignment="Left" ContentStringFormat=""></basec:P2StatusStrip>
                <TextBox Name="Status" Grid.Column="0" Grid.Row="3" Height="Auto" Width="Auto" Background="White" HorizontalAlignment="Right" Text="{Binding StatusName, Mode=OneWay}" IsReadOnly="True" BorderBrush="Transparent" />
            </Grid>
        </Border>

        <!-- Row 3: End -->
    </Grid>

</Window>
